package com.sen.controller;


import com.sen.common.api.ApiResult;
import com.sen.model.entity.BmsTip;
import com.sen.service.BmsTipService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 每日赠言 前端控制器
 * </p>
 *
 * @author ergou
 * @since 2021-04-07
 */
@RestController
@RequestMapping("/tip")
public class BmsTipController extends  BaseController {
    @Resource
    private BmsTipService bmsTipService;

    /**
     * 展示每日一句，在数据库中随机抽取一条信息
     * @return BmsBillboard
     */
    @GetMapping("/today")
    public ApiResult<BmsTip> getRandomTip(){
        //增加查询条件 字段type为1的时候显示
        BmsTip tip = bmsTipService.getRandomTip();
        return ApiResult.success(tip);
    }
}
